<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
	<link rel="stylesheet" href="${staticServer}/inc/style/main.css"/>
	<link rel="stylesheet" href="${staticServer}/inc/style/page.css"/>
	<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css"/>
	<link rel="stylesheet" href="${staticServer}/css/consultant_client.css"/>
	<link rel="stylesheet" href="${staticServer}/css/consultant_client_reserve_form.css"/>
	<link rel="stylesheet" href="${staticServer}/inc/style/reserve.css"/>
	<script src="${staticServer}/inc/js/jquery.js"></script>

	<script src="${staticServer}/inc/js/core/page_core.js"></script>
	<script src="${staticServer}/inc/js/core/utils.js"></script>
	<script src="${staticServer}/inc/js/pageset.js"></script>
	<script src="${staticServer}/inc/js/model_resp.js?2.0"></script>
	<script src="${staticServer}/inc/js/submitter.js"></script>
	<script src="${staticServer}/inc/js/datepicker.js"></script>
	<script src="${staticServer}/inc/js/model_win.js?2.0"></script>
	<script src="${staticServer}/inc/js/htmlfilter.js"></script>
	
	<script src="${staticServer}/inc/js/reserve.js?4.1"></script>
	<script src="${staticServer}/inc/js/consultants/ClientData.js"></script>
	<script src="${staticServer}/inc/js/consultants/ClientReserve.js?2.0"></script>
	<script src="${staticServer}/inc/js/consultants/ClientReception.js?2.3"></script>
	<script src="${staticServer}/inc/js/consultants/consultant_client_quest.js?2.0"></script>
	<script src="${staticServer}/inc/js/consultants/consultant_client_reception_d.js?2.1"></script>
	<script src="${staticServer}/js/web/consultant_client_reception.js?2.911"></script>
	<script type="text/javascript" src="${staticServer}/common/uploadify/jquery.uploadify.js"></script>
	<script type="text/javascript" src="${staticServer}/js/web/uploadImg.js?1.5"></script>
	
<style>
#__DIV_CLIENT_SELECTOR {
	width: 590px;
	height: 350px;
	border: 5px solid #f0f0f0;
	background: #f9f9f9;
}
#__DIV_CLIENT_SELECTOR dt {
	color: #fff;
	font-size: 16px;
	font-weight: bold;
	padding-left: 10px;
	padding-right: 10px;
	height: 40px;
	line-height: 40px;
	background: #D8A5CC;
	cursor: pointer;;
}
#__DIV_CLIENT_SELECTOR dt span, #__DIV_CLIENT_SELECTOR dt a {
    float: left;
}
#__DIV_CLIENT_SELECTOR dt a {
	color: #E3BFDB;
	float: right;
	font-size: 14px;
}
#__DIV_CLIENT_SELECTOR dt a:hover {
	color: #FFF;
}

#__DIV_CLIENT_SELECTOR #form {
    width: 90%;
    margin: 0 auto;
    padding: 10px 0 15px 10px;
    min-height: 25px;
}
#__DIV_CLIENT_SELECTOR #form label {
    display: block;
    float: left;
    height: 25px;
    color: #999;
    font-size: 15px;
    font-weight: bold;
    line-height: 25px;
    text-align: right;
}
#__DIV_CLIENT_SELECTOR #form label span {
    color: #ddd;
    font-size: 12px;
    font-weight: normal;
    font-size: 12px;
}
#__DIV_CLIENT_SELECTOR #form input {
    display: block;
    float: left;
}

#__DIV_CLIENT_SELECTOR #body {
	position: relative;
	display: block;
	width: 90%;
	height: 240px;
	margin: 0 auto;
	overflow-y: auto;
	padding: 2px;
	border: 1px dotted #ddd;
}
#__DIV_CLIENT_SELECTOR #body ul li {
	font-size: 14px;
	list-style: none;
	padding: 10px 20px 10px 20px;
	border-bottom: 1px solid #ccc;
	cursor: default;
}
#__DIV_CLIENT_SELECTOR #body ul li.empty {
    color: #999;
    font-size: 14px;
    list-style: none;
    padding: 10px 20px 10px 20px;
    border: none;
}
.bold {
    font-weight: bold;
}

#__DIV_CLIENT_SELECTOR #body ul li.selected {
    color: #CCAACC;
    border-color: #99cc00;
    background: #fff url(${staticServer}/img/ok.png) no-repeat 95%;
}
#__DIV_CLIENT_SELECTOR #form input {
	display: block;
	float: left;
}

.__CLIENT_INFO_LIST {
	min-height: 31px;
}

.__CLIENT_INFO_LIST span {
	color: #DDBBCC;
	min-width: 130px;
	min-height: 20px;
	height: auto;
	display: block;
	float: left;
}
#SWFUpload_0{
	margin-top: 70px;
    margin-left: -30px;
}
#SWFUpload_1{
	margin-top: 70px;
    margin-left: -30px;
}
#SWFUpload_2{
	margin-top: 70px;
    margin-left: -30px;
}
.uploadify-button-text{
	margin-left: 60px;
	margin-top: 70px;
}
	
	</style>
	
</head>
<script>
var contextPath='${contextPath}';
var _contextPath = '${staticServer}';

function worth_form(){
		var data = {};
		data.key = $("#key").val();
		
		data.rkey = $("#reskey").val();
		data.worth = $( "#worth" ).val();
		
        data.money = $("#money").val();
        data.moneyType = $("#moneyType").val();
		data.rep_date1 = $("#rep_date1").val();
		data.all_words2 = $("#all_words2").val();
		
		data.nestid = $("#nestid").val();
		data.earnestType = $("#earnestType").val();
		data.nest_date = $("#nest_date").val();
		data.all_words = $("#all_words").val();
		data.beizhu = $("#beizhu").val();
		
		if(data.money!=""){
			if(data.moneyType==""){
				alert("请选择缴费类型!");
				return;
			}
		}
		
		if(data.nestid!=""){
			if(data.earnestType==""){
				alert("请选择缴费类型!");
				return;
			}
		}
		
		if(data.money!=""){
			if(data.all_words2 ==""){
				alert("请上传凭证（图片格式）!");
				return;
			}
		}
		
		if(data.nestid!=""){
			if(data.all_words ==""){
				alert("请上传凭证（图片格式）!");
				return;
			}
		}
	
		if(window.confirm('保存后日期和金额将不可修改！')){
		submitter.post( "${contextPath}/index/consultant_client_reception_go.json", data, function( d ){
			alert("保存成功！");
			$("#key").val(d.key);
			$("#reskey").val(d.rkey);
			if(d.money!=''){
				$("#money").attr('disabled','true');
			}
			if(d.rep_date!=''){
				$("#rep_date1").attr('disabled','true');
			}
			
			if(d.nestid!=''){
				$("#nestid").attr('disabled','true');
				$("#nest").attr('disabled','true');
				$("#nestid").attr('value',d.nestid);
				
			}
			if(d.nest_date!=''){
				$("#nest_date").attr('disabled','true');
			}
			
			}, "json" );
	       		return true;
	     }else{
	            return false;
	   }	
}
</script>
<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>咨询师业务管理</li>
			<li>&gt;</li>
			<li class="current">客户接待</li>
		</ul>
	</div>
	<div id="caption">
		<ul>
			<li><span class="title">操作提示：</span></li>
			<li>Ctrl+Enter 提交</li>
		</ul>
	</div>
	<div id="container">
		<div id="title" style="color:red;">注意：填写接待信息的时候，必须要填写学生的测评信息。如果一个客户有两个学员，两个学员都要填写测评信息。学生测评信息不填写不会核算接待绩效。</div>
		<input type="hidden" id="reskey" value="">
		
		<input type="hidden" id="key" value="">
		
		<table id="tbl_client">
			<tbody><tr rel="title" class="fields" style="cursor: pointer;">
				<th colspan="2">客户资料</th>
			</tr>
		<tr class="even_row"><th width="25%">客户姓名/称呼</th>
			<td width="75%"><span id="nickname" name="" class="stress unit hand">
				<em class="caption"> - - </em></span><a id="btnSelector">（选择目标客户）</a>/<a id="btnSelectReserve">（选择预约客户）</a></td></tr>
				       
				<th>客户来源渠道</th>
				<td id="source">&nbsp;</td></tr>
				<tr rel="hide" class="even_row" style="display: none;">
				<th>关键字</th>
				<td id="keyword">&nbsp;</td></tr>
				<tr rel="hide" class="odd_row" style="display: none;">
				<th>客户类别</th>
				<td id="category">&nbsp;</td></tr>
				<tr rel="hide" class="even_row" style="display: none;">
				<th>问卷地址</th><td colspan="3" id="quest_list">&nbsp;</td></tr>
				<tr class="odd_row">
				<th>所在地</th>
				<td id="address">&nbsp;</td></tr>
				<tr class="even_row">
				<th>联系电话</th>
				<td id="phone">&nbsp;</td></tr>
				<tr rel="hide" class="odd_row" style="display: none;">
				<th>电子邮箱</th><td id="email">&nbsp;</td></tr>
				<tr rel="hide" class="even_row" style="display: none;">
				<th>QQ</th><td id="qq">&nbsp;</td></tr>
				<tr rel="hide" class="odd_row" style="display: none;">
				<th>IP地址</th><td id="ip">&nbsp;</td></tr>
				<tr rel="hide" class="even_row" style="display: none;">
				<th>备注信息</th><td id="desc">&nbsp;</td></tr>
				</tbody></table>

		<table id="tbl_reception">
		<tbody>
			<tr  rel="title" class="fields" style="cursor: pointer;">
				<th colspan="2">客户接待表单</th>
			</tr>
			
			<tr >
				<th width="25%">接待日期</th>
				<td width="75%">
					<input title="" type="text" id="rep_date" value="${.now?date}" size="15" maxlength="15" rel="DATE::Y-m-d"/>
					<em class="caption">（默认为今日日期）</em>
				</td>
			</tr>
	
			<tr >
				<th width="25%">接待中心地址</th>
				<td width="75%" id="rep_region_box"></td>
			</tr>
			
			<tr >
				<th width="25%">接待老师<p class="caption">请选择与预约时相同的接待老师名字</p></th>
				<td width="75%" class="stress unit hand" id="rep_user_box"></td>
			</tr>
			
			<tr>
				<th width="25%">继续跟踪价值</th>
				<td width="75%" id="rep_worth_box">
				</td>
				
			</tr>
			
			<tr id="pingzheng" style="display:none;">
				<th width="25%">上传凭证</th>
				
				<td width="99%" id="img1" style="display:block;height:240px;">
				<ul class="imglist">
					定金凭证：
					<div id="images">
					</div>
						
					<a class="file_box" style="display: block; width:180px; height:180px; overflow: hidden; border: 1px solid #EBEBEB; background: none repeat scroll 0 0 #F3F3F3; color: #999999; cursor: pointer; text-align: center; margin-top:20px; margin-left:10px; ">
                        <em style="background:url(${staticServer}/img/add_newpic.png) 0 0; display: inline-block; width:180px; height:180px; overflow: hidden;line-height: 20em; vertical-align: middle;">
                        <input type="file" id="upload" style="display: block;width:180px; height:180px;opacity: 0; filter:alpha(opacity=0); "></em>
                        </a>
                    	<label class="zt_widthlabel" style=" font-size:9px; float:left; visibility:hidden;">文件：</label>
                        <input type="text" id="all_words" style=" width:100px; height:10px; float:left;visibility:hidden;" class="input w180" value="">
				</ul>
				</td>
				
				<td width="99%" id="img2" style="display:block;height:240px;">
				<ul class="imglist">
					  已成交、交款1凭证：
					<div id="images2">
					</div>
					<a class="file_box" style="display: block; width:180px; height:180px; overflow: hidden; border: 1px solid #EBEBEB; background: none repeat scroll 0 0 #F3F3F3; color: #999999; cursor: pointer; text-align: center; margin-top:20px; margin-left:10px; ">
                        <em style="background:url(${staticServer}/img/add_newpic.png) 0 0; display: inline-block; width:180px; height:180px; overflow: hidden;line-height: 20em; vertical-align: middle;">
                        <input type="file" id="upload2" style="display: block;width:180px; height:180px;opacity: 0; filter:alpha(opacity=0); "></em>
                        </a>
                    	<label class="zt_widthlabel" style=" font-size:9px; float:left; visibility:hidden;">文件：</label>
                        <input type="text" id="all_words2" style=" width:100px; height:10px; float:left;visibility:hidden;" class="input w180" value="">
				</ul>
				</td>
				
				<td width="99%" id="img3" style="display:block;height:240px;">
				<ul class="imglist">
					 已成交、交款2凭证：
					<div id="images3">
					</div>
					<a class="file_box" style="display: block; width:180px; height:180px; overflow: hidden; border: 1px solid #EBEBEB; background: none repeat scroll 0 0 #F3F3F3; color: #999999; cursor: pointer; text-align: center; margin-top:20px; margin-left:10px; ">
                        <em style="background:url(${staticServer}/img/add_newpic.png) 0 0; display: inline-block; width:180px; height:180px; overflow: hidden;line-height: 20em; vertical-align: middle;">
                        <input type="file" id="upload3" style="display: block;width:180px; height:180px;opacity: 0; filter:alpha(opacity=0); "></em>
                        </a>
                    	<label class="zt_widthlabel" style=" font-size:9px; float:left; visibility:hidden;">文件：</label>
                        <input type="text" id="all_words3" style=" width:100px; height:10px; float:left;visibility:hidden;" class="input w180" value="">
				</ul>
				</td>
				
			</tr>

			<tr>
				<th width="25%">来人特征或备注</th>
				<td width="75%">
					<textarea title="" id="rep_feature"  rows="1" style="width:95%;"></textarea>
					<p class="line"></p>
					<p class="caption">接待时，来人或者客户本人的特征等情况，以及非预约接待等相关情况记录</p>
				</td>
			</tr>

			<tr >
				<th width="25%">追加跟踪记录</th>
				<td width="75%">
					<a id="btnAddTracking">[ 添加客户跟踪记录 ]</a>
					<p class="caption">为此次接待，增加必要的客户跟踪记录</p>
				</td>
			</tr>

			<tr>
				<th width="25%">目标学员<p class="caption">勾选指定的学员，填写测评记录数据</p></th>
				<td width="75%">
					<div id="rep_student_box" style="overflow:hidden;"></div>
					<p class="line"></p>
					<p class="caption">
						此次接待所涉及的学员目标，勾选指定的学员，在下方弹出测评表单填写测评记录数据<br>
						只有指定目标学员才计算绩效。测评类型接待必须指定，上门接待也可设置目标学员测评情况。
					</p>
				</td>
			</tr>
		 </tbody>
		</table>

		<!-- 学员测评表 -->
		<div id="student_test_recycle"></div>
		<div id="student_test_list" style="display: block;"></div>

		<!-- 学员接待测评情况表模板 -->
		<table id="tbl_student_temp">
			<tr class="fields">
				<th colspan="2">学员情况</th>
			</tr>
				<tr>
					<th width="25%">基本资料</th>
					<td width="75%">
						<span class="rect stress" rel="student_info">XXX，男，8 岁</span>
						<a rel="" id="btnStudent" class="submit" title="点击编辑学员资料、特征、训练类型、学员卡、课时数、仪器编号">[ 编辑学员资料 ]</a>
						<p class="line"></p>
						<p class="caption">
							学员资料包括<span class="quote">基本资料、学员特征、训练类型、学员卡、课时数、仪器编号</span>等
						</p>
					</td>
				</tr>
			<tr>
				<th width="25%">测评老师</th>
				<td width="75%" id="testuser" rel="testuser"></td>
			</tr>

			<tr>
				<th width="25%"><label for="price">学费报价情况</label></th>
				<td width="75%">
					<textarea id="price" rows="1" style="width:95%;"></textarea>
					<p class="line"></p>
					<p class="caption">学费报价、对应课时数量等情况记录</p></td>
			</tr>
			<tr>
				<th width="25%"><label for="moneylog">实际缴费情况</label></th>
				<td width="75%">
					<textarea id="moneylog" rows="1" style="width:95%;"></textarea>
					<p class="line"></p>
					<p class="caption">记录实际缴费金额，包括定金，余款等等。例如：9.1定金 1000,9.10 余款 21000</p></td>
			</tr>

			<tr>
				<th width="25%"><label for="reason">未成交原因</label></th>
				<td width="75%">
					<textarea id="reason" rows="1" style="width:95%;"></textarea>
					<p class="line"></p>
					<p class="caption">如“未做成原因、情况等”</p></td>
			</tr>
			<tr>
				<th width="25%"><label for="remark">其它备注情况</label></th>
				<td width="75%">
					<textarea id="remark" rows="1" style="width:95%;"></textarea>
					<p class="line"></p>
					<p class="caption">如“做成后的反复、纠缠程度等”</p></td>
			</tr>

			<tr>
				<th width="25%">测评完成项目调查<a rel="btnArrow" class="arrow" title="展开/隐藏调查表"></a></th>
				<td width="75%" rel="result"><a rel="btnShowVote" class="submit" style="display:block;">[ 展开调查表 ]</a>
					<div id="" style="display:none;"><p>1、孩子是否喜欢培训老师</p><p rel="TR_1">
					<span class="rect">
					<input type="radio" name="TR_1" id="TR_1_1" value="1">
					<label for="TR_1_1" class="hand" style="padding:0 20px 0 0;">是</label></span>
					<span class="rect " style="margin-left:50px;">
					<input type="radio" name="TR_1" id="TR_1_2" value="2">
					<label for="TR_1_2" class="hand" style="padding:0 20px 0 0;">否</label></span></p>
					<p class="line"></p><p>2、软件测评出生年月日是否准确</p>
					<p rel="TR_2"><span class="rect"><input type="radio" name="TR_2" id="TR_2_1" value="1"><label for="TR_2_1" class="hand" style="padding:0 20px 0 0;">是</label></span><span class="rect" style="margin-left:50px;"><input type="radio" name="TR_2" id="TR_2_2" value="2"><label for="TR_2_2" class="hand" style="padding:0 20px 0 0;">否</label></span></p><p class="line"></p><p>3、测评老师是否做了记录，并向咨询老师介绍了孩子详细的情况</p><p rel="TR_3"><span class="rect"><input type="radio" name="TR_3" id="TR_3_1" value="1"><label for="TR_3_1" class="hand" style="padding:0 20px 0 0;">是</label></span><span class="rect" style="margin-left:50px;"><input type="radio" name="TR_3" id="TR_3_2" value="2"><label for="TR_3_2" class="hand" style="padding:0 20px 0 0;">否</label></span></p><p class="line"></p><p>4、咨询过程中，孩子是否没管住跑到咨询室了</p><p rel="TR_4"><span class="rect"><input type="radio" name="TR_4" id="TR_4_1" value="1"><label for="TR_4_1" class="hand" style="padding:0 20px 0 0;">是</label></span><span class="rect" style="margin-left:50px;"><input type="radio" name="TR_4" id="TR_4_2" value="2"><label for="TR_4_2" class="hand" style="padding:0 20px 0 0;">否</label></span></p><p class="line"></p><p>5、是否和家长产生争执</p><p rel="TR_5"><span class="rect"><input type="radio" name="TR_5" id="TR_5_1" value="1"><label for="TR_5_1" class="hand" style="padding:0 20px 0 0;">是</label></span><span class="rect" style="margin-left:50px;"><input type="radio" name="TR_5" id="TR_5_2" value="2"><label for="TR_5_2" class="hand" style="padding:0 20px 0 0;">否</label></span><span style="margin-left:50px;"><label for="TXT_5" class="stress">争执原因：</label><input type="text" name="TXT_5" size="30"></span></p><p class="line"></p><p>6、是否完成全部测评（备注原因）</p><p rel="TR_6"><span class="rect"><input type="radio" name="TR_6" id="TR_6_1" value="1"><label for="TR_6_1" class="hand" style="padding:0 20px 0 0;">是</label></span><span class="rect" style="margin-left:50px;"><input type="radio" name="TR_6" id="TR_6_2" value="2"><label for="TR_6_2" class="hand" style="padding:0 20px 0 0;">否</label></span><span style="margin-left:50px;"><label for="TXT_6" class="stress">未完成原因：</label><input type="text" name="TXT_6" size="30"></span></p><p class="line"></p><p>7、脑电数据是否有较大错误（如太低或太高）</p><p rel="TR_7"><span class="rect"><input type="radio" name="TR_7" id="TR_7_1" value="1"><label for="TR_7_1" class="hand" style="padding:0 20px 0 0;">是</label></span><span class="rect" style="margin-left:50px;"><input type="radio" name="TR_7" id="TR_7_2" value="2"><label for="TR_7_2" class="hand" style="padding:0 20px 0 0;">否</label></span><span style="margin-left:50px;"><label for="TXT_7" class="stress">错误描述：</label><input type="text" name="TXT_7" size="30"></span></p><p class="line"></p></div>
				</td>
			</tr>
		</table>

		<div class="remark">
			<ul>
				<li><span class="title">注意事项：</span></li>
				<li>1、客户接待时，可以同时填写测评数据和学员特征等数据</li>
				<li>2、学员数据之后需要通过“完善学员资料、学员查询”入口单独维护</li>
				<li>3、未被勾选的“学员目标”的测评数据，将不会予以保存</li>
			</ul>
		</div>
		<div id="controlbar">
			<input id="btnSubmit" type="button" class="submit" value="  保存接待数据  "/>
			
		</div>
	</div>

<div id="__DIV_CLIENT_SELECTOR_MASK" style="display:none;position: absolute; z-index: 8999; opacity: 0.2; width: 100%; height: 1525px; left: 0px; top: 0px; background-color: rgb(0, 0, 0);"></div>
	
<div id="__DIV_CLIENT_SELECTOR" style="display:none;position: absolute; z-index: 9000;left: 407.5px; top: 218.5px;">
	<dt>
		<span id="title">历史客户资源搜索</span><a id="btn_cancel">[ 取消 ]</a> <a id="btn_enter">[ 确定 ]</a>
	</dt>
	<div id="form">
		<label>过滤条件：<span>（多条件精确搜索按顺序以空格分开，若无空格则尝试搜索符合条件的所有记录）</span></label>
		<input id="condition" type="text" value="" size="76" placeholder="姓名/学员名/渠道/类别/电话/邮箱/QQ/地区">
	</div>
	<div id="body">
		<ul id="tishi">
			<li class="empty">
				请输入搜索条件，自动匹配的结果在此处列出。<br><br>
				<p class="bold">条件格式：</p>
				<p>（1）<span class="bold">单条件</span> "姓名/学员名/渠道/类别/电话/邮箱/QQ" 任一包含条件的记录。</p>
				<p>（2）<span class="bold">顺序多条件</span> 如"张三 学员 商桥 学员客户 15387346628 xxx@126.com 29134"，至少须两个条件，以空格分开。</p>
				<p style="word-break:break-all;">（3）<span class="bold">无序精确条件</span> 如"姓名=张三"、"学员=张某某"、"渠道=商桥"、"类别=广告推销"、"电话=15387346628"、"邮箱=xxx@126.com"、"QQ=29134"。</p>
				<p><br><span class="bold">提醒：</span> 条件内容都是模糊查询，可不用写全。精确条件项目可不按顺序设置。</p>
			</li>
		</ul>
		<ul id="clients" style="display:none">
		</ul>
	</div>
</div>
</body>
<script>
	var contextPath='${contextPath}';
$(function(){
	$("#btnSelector").click(function(){
		$("#__DIV_CLIENT_SELECTOR_MASK").show();
		$("#__DIV_CLIENT_SELECTOR").show();
	});
	
	$("#condition").on('input',function(e){
		var condition = $("#condition").val();
		if(condition!=null && condition!=""){
			$("#tishi").hide();
			$("#clients").show();
			$("#clients").val("");
			$.post("${contextPath}/index/getclientbytype.json", {
				"condition":condition
			}, function(data) {
				var list = data.list;
				var objHtml = "";
				var phone = "";
				for(var i=0;i<list.length;i++){
					var youxiao = "";
					if(list[i].invalid== "0" ){
						youxiao="有效客户";
					}else{
						youxiao="无效客户";
					}
					var ph = list[i].phlist;
					if(ph!=null){
					for(var j=0;j<ph.length;j++){
						phone = ph[j].phone;
					}
					}else{
						phone = list[i].phone;
					}
					objHtml +='<li style="cursor:pointer" id="'+list[i].id+'" onclick="getCheck('+list[i].id+')"><span class="stress">'+list[i].nickname+'</span>（'+list[i].province+' - '+list[i].city+'）<em class="valid"> - '+youxiao+'</em><p class="__CLIENT_INFO_LIST"><span><b>渠道</b>：'+list[i].sourcens+'</span><span><b>类别</b>：'+list[i].categoryns+'</span><span><b>电话</b>：'+phone+'</span></p></li>'
				}
				
				$("#clients").html(objHtml);
				
			});
		}else{
			$("#tishi").show();
			$("#clients").hide();
		}
	});
	
	$("#btn_enter").click(function(){
		var id = $("#clients").find(".selected").attr("id");
		$.post("${contextPath}/index/getclientall.json", {
				"id":id
			}, function(data) {
				$("#__DIV_CLIENT_SELECTOR_MASK").hide();
				$("#__DIV_CLIENT_SELECTOR").hide();
				$("#username").hide();
				
				var ulist = data.uList;
				var offlist = data.offList;
				var client = data.client;
				var stulist = data.stuList;
				var user = data.user;
				var use1List = data.use1List;
				var useList = data.useList;
				var use2List = data.use2List;
				var phone ="";
				
				if(client!=null){
					var youwu="";
					if(client.invalid=="0"){
						youwu="有效客户";
					}else{
						youwu="无效客户";
					}
					
					var ph = client.phlist;
					if(ph!=null){
					for(var j=0;j<ph.length;j++){
						phone = ph[j].phone;
					}
					}else{
						phone = client.phone;
				  }
					$("#nickname").html(client.nickname+'<em class="valid">'+youwu+'</em>');
					$("#nickname").attr("name",client.keyname);
					$("#source").html(client.sourcens);
					$("#keyword").html(client.keyword);
					$("#category").html(client.categoryns)
					$("#phone").html(phone);
					$("#address").html(client.province+" - "+ client.city);
					$("#email").html(client.email);
					$("#qq").html(client.qq);
					$("#ip").html(client.ip);
					$("#desc").html(client.descs);
					
				}
				
				var htm = $("#student_test_list").html(" ");
				
				
				getTeacher(user.region);
				var offhtml = "";
				offhtml = '<select id="region" onchange="offChange(this.value)">'
					offhtml += '<option value="">-- 请选择 --</option>' 
				for(var h=0;h<offlist.length;h++){
				if(user.region == offlist[h].keyname){
					offhtml +='<option value="'+offlist[h].keyname+'" selected>'+offlist[h].name+'</option>'
					}else{
					offhtml +='<option value="'+offlist[h].keyname+'">'+offlist[h].name+'</option>'
					}
				}
				offhtml +='</select>';
				$("#rep_region_box").html(offhtml);
				
				var uhtml = "";
				uhtml += '<select name="target" id="target" >'
				uhtml += '<option value="">-- 请选择目标 --</option>'
				for(var h=0;h<ulist.length;h++){
					if(user.username == ulist[h].username){
						uhtml +='<option  value="'+ulist[h].username+'" selected>'+ulist[h].nickname+'（'+ulist[h].regions+'-'+ulist[h].departments+'-'+ulist[h].job+'）</option>';
					}else{
						uhtml +='<option  value="'+ulist[h].username+'">'+ulist[h].nickname+'（'+ulist[h].regions+'-'+ulist[h].departments+'-'+ulist[h].job+'）</option>';
					}
				}
				uhtml +='</select>';
				
				var uhtml2 = "";
				uhtml2 += '<select name="target" id="target2" >'
				uhtml2 += '<option value="">-- 请选择接待老师2 --</option>'
				for(var h=0;h<ulist.length;h++){
					uhtml2 +='<option  value="'+ulist[h].username+'">'+ulist[h].nickname+'（'+ulist[h].regions+'-'+ulist[h].departments+'-'+ulist[h].job+'）</option>';
				}
				uhtml2 +='</select>';
				$("#rep_user_box").html(uhtml+uhtml2);
				
				worths();		   
				
				
				
				var Objhtml = "";
					Objhtml = '<ul id="rep_student">'
				for(var i=0;i<stulist.length;i++){
					Objhtml += '<li rel="'+stulist[i].keyname+'" onclick="check('+stulist[i].id+')" id="'+stulist[i].id+'"  class="stress rect" style="list-style:none;float:left;width:200px;margin:2px;">'+
							   '<label><input type="checkbox" checked id="'+stulist[i].keyname+'" rel="'+stulist[i].keyname+'">'+
							   '<span>'+stulist[i].nickname+'  ，'+stulist[i].sex+' ， '+stulist[i].age+' 岁</span>'+
							   '</label></li>'
					setStudentTest(stulist[i].keyname,i);
				}
					Objhtml +='</ul>'
				$("#rep_student_box").html(Objhtml); 
				
				if(user!==null){
					$("#user_nickname").html(user.nickname);
					$("#date").val($("#dates").val());
					$("#time").val($("#times").val());
				}
		});
	});
	
	$("#btn_cancel").click(function(){
		$("#__DIV_CLIENT_SELECTOR_MASK").hide();
		$("#__DIV_CLIENT_SELECTOR").hide();
	});
	
	
	
});

/**
function worth(worth){
	var htm = "";
	$("#req_money").html(" ");
	$("#req_ear").html(" ");
	$("[name=nest]:checkbox").prop("checked", false);
	nest();
	$("#pre_times").hide();
	$("#earnests").hide();
	$("#pingzheng").hide();
	$("#img1").hide();
	$("#img2").hide();
	$("#img3").hide();
	$("#kecheng").hide();
   if(worth==6){
   		var keyname = $("#region").val();
   		$.post("${contextPath}/index/getMethod.json", {
			"keyname":keyname
		}, function(ms) {
			var list = ms.mList;
			var objHtml = '<select id="moneyType"><option value="">请选择缴费类型</option>';
			for(var i=0;i<list.length;i++){
				objHtml +='<option value="'+list[i].id+'">'+list[i].name+'</option>';
			}
			htm = objHtml+'</select><span class="moneyid" style="display:inherit;padding-left:15px;">'+
	 		 '成交金额:<input name="money" id="money" rel="st_money" value="" placeholder="填写金额" size="10" maxlength="15" />元'+
			 '</span>';
			$("#req_money").show();
			$("#pre_times").show();
			$("#pingzheng").show();
			$("#img2").show();
			$("#kecheng").show();
			$("#req_money").append(htm);
		});
		
	}
	
	 if(worth==5){
		$("#earnests").show();
		$("#pingzheng").show();
		$("#img1").show();
		$("#kecheng").show();
	}
	
}**/


var getCheck = function(id){
	$("#clients li").removeClass("selected");
	$("#"+id).addClass("selected");
} 

function setStudentTest(d,f){
	$("#student_test_list").css("display","block");
    ClientReception.prototype.setStudentTestData(d,f);
    }
    
function check(d){
	var id = $("#"+d).attr("rel");
	if($("#"+id).is(':checked')){
		$("#student_test_list").find('#'+id).parent().show();
		$("#student_test_list").find('#'+id).show();
	}else if($("input[type='checkbox']").is(':checked')){
		$("#student_test_list").find('#'+id).css("display","none");
	}else{
		$("#student_test_list").find('table').css("display","none");
		$("#student_test_list").find('#'+id).parent().hide();
	}
}
function offChange(d){
	if(d==""){
		return;
	}
	$("#rep_worth").val("");
	getTeacher(d);
	
	$("#req_money").hide();
	$("#pre_times").hide();
	$("#req_ear").hide();
	$("#earnests").hide();
}

$(document).ready(function(){
var bh =$(window).height()/2;
var bw =$("body").width()/2;
var h = $("#__DIV_CLIENT_SELECTOR").height()/2;
var w =$("#__DIV_CLIENT_SELECTOR").width()/2;
var mh = bh-h-50;
var mw = bw-w;
  $("#__DIV_CLIENT_SELECTOR").css({"top":mh,"left":mw,"position":"fixed"});
  $("#__DIV_CLIENT_SELECTOR_MASK").css("position","fixed");
});



var getTeacher = function(d){
	$.post("${contextPath}/index/consultant_reserve_uses.json", {
				"center":d
			}, function(ms) {
		var use1List = ms.list;
		var uhtml = "";
		uhtml +=  '<select name="testusers" id="testusers" >'
		uhtml +=  '<option value="">-- 请选择目标 --</option>'
		for(var i=0;i<use1List.length;i++){
			uhtml +='<option value="'+use1List[i].username+'">'+use1List[i].nickname+'（'+use1List[i].region+'）</option>';
		}
		$("#student_test_list").find("[rel='testuser']").html(uhtml);
	});
}

function worths(){
	var whtml = "";
			whtml +='<select id="rep_worth">'+
			'<option value="">-- 请选择 --</option>'+
			'<option value="1">保持客情</option>'+
			'<option value="2">保持长期跟踪</option>'+
			'<option value="3">计划跟踪回访</option>'+
			'<option value="4">短期跟踪回访</option>'+
			'<option value="5">必须跟踪争取</option>'+
			'<option value="6">已成交</option>'+
			'</select>'+
			'<span id="req_money"></span>'+
			'<span id="pre_times" style="display:none;padding-left:15px;">'+
	 		'成交时间:<input title="" style="margin-right:10px;" type="text" id="rep_date1" value="" size="15" maxlength="15" rel="DATE::Y-m-d" readonly="readonly">'+
			'<br/>缴费备注:<input style="width: 310px;" id="beizhu" value="">'+
			'<input type="button" onclick="worth_form()" class="submit" value="保存成交数据"/>'+
			'</span>'+
			'<span id="earnests" style="display:none;padding-left:15px;"><input name="nest" id="nest" onclick="nest()" type="checkbox"  value="" />定金</span>'+
			'<span id="req_ear"></span>'
			$("#rep_worth_box").html(whtml);
			$("#rep_date1").Zebra_DatePicker({ format: 'Y-m-d', show_icon: false} );
}

function nest(){
	 if($("#nest").prop("checked")){
	 	var htm = "";
		$("#req_ear").html(" ");
		
		var keyname = $("#region").val();
   		$.post("${contextPath}/index/getMethod.json", {
			"keyname":keyname
		}, function(ms) {
			$("#req_ear").show();
			$("#earnests").show();
			var list = ms.mList;
			var objHtml = '<select id="earnestType"><option value="">请选择缴费类型</option>';
			for(var i=0;i<list.length;i++){
				objHtml +='<option value="'+list[i].id+'">'+list[i].name+'</option>';
			}
			htm = objHtml+'</select><span class="nestid" style="display:inherit;padding-left:15px;">'+
		 		 '定金金额:<input name="nestid" id="nestid" rel="st_nest" value="" placeholder="填写金额" size="10" maxlength="15" />元'+
				 '</span>'+
				 '<span id="req_ears" style="display:inherit;padding-left:15px;">定金时间:<input title="" style="margin-right:10px;" type="text" id="nest_date" value="" size="15" maxlength="15" rel="DATE::Y-m-d" readonly="readonly">'+
				 '</span>'+
				 '<br/>缴费备注:<input style="width: 310px;" id="beizhu" value="">'+
				 '<input type="button" onclick="worth_form()" class="submit" value="保存成交数据"/>';
			$("#req_ear").append(htm);
			$("#nest_date").Zebra_DatePicker({ format: 'Y-m-d', show_icon: false} );
		});
		
			
		}else{
			$("#req_ear").html(" ");
		}
}

</script>
</html>

